<%@ include file="/en/jsp/static.jsp" %>
<%@ taglib uri="/linuxbox/bbs.tld" prefix="bbs" %>
<%
  String CAT_ID = (String)request.getAttribute("CAT_ID");
  String CAT_NAME = (String)request.getAttribute("CAT_NAME");
  String USER_NAME = (String)request.getAttribute("USER_NAME");
  String TOPIC_ID = (String)request.getAttribute("TOPIC_ID");
  String MSG_ID = (String)request.getAttribute("MSG_ID");
  String IND_LVL = (String)request.getAttribute("IND_LVL");
  String SUBJECT = (String)request.getAttribute("SUBJECT");
  String MSG_BODY = (String)request.getAttribute("MSG_BODY");
%>

<jsp:include page="/en/jsp/header.jsp" flush="true"/>

<script language="JavaScript">
function checkFields() {
  if (document.FORM.CONTENT.value.length > 4000) {
    alert("The contect is too long!");
    document.FORM.CONTENT.focus();
    return (false);
  }
  return (true);
}


function submitMsg() {
  if (checkFields()) {
//      document.FORM.action = "<%=BoxStatic.servletDir%>BbsProposeAction";
      document.FORM.submit();
  }
}
function onChangeCategory()
{
    document.theForm.submit();
}
</script>


<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
  <tr>
    <td>
      &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
      <b><%=boxName%> - BBS - Create New Message</b>
    </td>
<FORM action="<%=BoxStatic.servletDir%>BbsContentAction" method="POST" name="theForm" >
    <td ALIGN="right" valign="top">
      <a href="<%=BoxStatic.jspDir%>bbs/BbsNewList.jsp">New List</a>&nbsp;|&nbsp;

      <a href="<%=BoxStatic.jspDir%>bbs/BbsQueryAll.jsp">Search</a>

      &nbsp;|&nbsp;View Category
        <SELECT NAME="CAT_ID" onclick="onChangeCategory()">
          <bbs:BbsCatList listType="list" selected="<%=CAT_ID%>" />
        </select>
    </td>
</form>
  </tr>
</table>

<hr width="100%" color=#E06000 align=left>

<b>Message Propose</b>

<% if (Integer.parseInt(MSG_ID) > 0) { %>
  <!--Reply message-->
  <table border=0 cellspacing=0 cellpadding=1 width="98%">
  <tr><td>
    <bbs:ShowTopic topicID="<%=TOPIC_ID%>" catID="<%=CAT_ID%>" msgID="<%=MSG_ID%>"/>
  </td></tr>
  </table>
  <% SUBJECT = "Reply: " + SUBJECT;
} %>

  <form method="POST" name="FORM" action ="<%=BoxStatic.servletDir%>BbsProposeAction">
    <table border=0 width="98%" bgcolor=#e0e0e0 style="font-size:14px">
      <tr>
      <td nowrap><b>Category: </b></td>
      <td nowrap><%=CAT_NAME%>
        <input type="hidden" name="CAT_ID" value="<%=CAT_ID%>">
        <input type="hidden" name="CAT_NAME" value="<%=CAT_NAME%>">
      </td>
      </tr>
      <tr>
      <td nowrap><b>Author: </b></td>
      <td nowrap><%=USER_NAME%>
        <input type="hidden" name="AUTHOR" value="<%=USER_NAME%>">
        <input type="hidden" name="TOPIC_ID" value="<%=TOPIC_ID%>">
        <input type="hidden" name="MSG_ID" value="<%=MSG_ID%>">
        <input type="hidden" name="IND_LVL" value="<%=IND_LVL%>">
      </td>
      </tr>
      <tr>
      <td nowrap><b>Subject: </b></td>
      <td nowrap>
        <input type="text" size=80 maxlength=80 name="SUBJECT" value="<%=SUBJECT%>">
      </td>
      </tr>
      <tr>
      <td  nowrap valign="top"><b>Content: </b></td>
      <td>
        <textarea name="CONTENT" rows=12  cols=80><%=MSG_BODY%></textarea><br>
      </td>
      </tr>
      <tr>
      <td></td>
      <td>
        <input type="button" name="SubmitEdit" value="Save" onclick="submitMsg()">
        <input type=button value="Cancel" onclick="window.history.go(-1)" >
      </td>
      </tr>
    </table>
  </form>

<hr width="100%" color=#E06000 align=left>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
